package com.leetCode;

import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Set;
import java.util.Map.Entry;

/**
 * @author lyk
 *
 */
public class Demo {

	public static void main(String[] args) throws Exception {
		Solution s = getInstance();
		HashMap<String, String> hm = new HashMap<>();
		hm.put("babad", "bab");
//		check(hm,s);
		String k = "e1baabb";
		System.out.println(k+":"+s.test(k));
	}
	class Solution {
		public String test(String a) {
			System.out.println("test");
			return "";
		}
	}
	
	public static void check(HashMap<String, String> hm,Solution s){
		Set<Entry<String,String>> entrySet = hm.entrySet();
		for (Entry<String, String> entry : entrySet) {
			String key = entry.getKey();
			String value = entry.getValue();
			if(value.equals(s.test(key))){
				System.out.println(key+":"+s.test(key)+"===>"+true);
			}else{
				System.out.println(key+":"+s.test(key)+"===>"+false);
			}
		}
	}

	static Solution getInstance() throws Exception {
		String className = Thread.currentThread().getStackTrace()[1].getClassName();
		Class<?> forName = Class.forName(className);
		Method method = forName.getMethod("newS", null);
		Solution solution = (Solution) method.invoke(forName.newInstance(), null);
		return solution;
	}

	public Solution newS() {
		return new Solution();
	}

}
